#define _CRT_SECURE_NO_WARNINGS
#include"tree.h"
#include<stdio.h>
#include<stdlib.h>
BTNode* BuyNode(int data)
{
	BTNode* newnode = (BTNode*)malloc(sizeof(BTNode));
	if (newnode == NULL)
	{
		perror("malloc fail!");
		return NULL;
	}
	newnode->data = data;
	newnode->left = NULL;
	newnode->right = NULL;
	return newnode;
}
BTNode* CreatTree()
{
	BTNode* node1 = BuyNode(1);
	BTNode* node2 = BuyNode(2);
	BTNode* node3 = BuyNode(3);
	BTNode* node4 = BuyNode(4);
	BTNode* node5 = BuyNode(5);
	BTNode* node6 = BuyNode(6);
	BTNode* node7 = BuyNode(7);


	node1->left = node2;
	node1->right = node4;
	node2->left = node3;
	node4->left = node5;
	node4->right = node6;
	node3->right = node7;

	return node1;
}

int main()
{
	BTNode* root = CreatTree();
	BinaryTreePrevOrder(root);
	BinaryTreeLevelOrder(root);
	return 0;
}